package com.xj.demo.string;

public class StringTest2 {
    public static void main(String[] args) {
        String str1 = "abc";
        String str2 = "defg";
        String str3 = "abcdefg";
        String str4 = "abc" + "defg";
        String str5 = str1 + "defg";
        String str6 = "abc" + str2;
        String str7 = str1 + str2;
        System.out.println(str3 == str4);// true
        System.out.println(str3 == str5);// false
        System.out.println(str3 == str6);// false
        System.out.println(str3 == str7);// false
        System.out.println(str5 == str6);// false
        System.out.println(str5 == str7);// false
        String str8 = str6.intern();
        System.out.println(str3 == str8);// true
    }
}
